package restfuljobs

class JobApplicationReviewWrapper extends JobApplicationReview {

    private Long id
	
	public Long getId() {
		return id
	}
	
	public void setId(Long id) {
		this.id = id
	}
		
	public void setFromXML(def node) {
		
		node.childNodes().each {
		
			if (it.name == "reviewer") {
				this.reviewer = new UserWrapper()
				this.reviewer.id = it.attributes()['id'].toLong()
				it.each {				
					this.reviewer.setFromXML(it)
				}	
			} else if (it.name == "application") {
				this.application = new JobApplicationWrapper()
				if (it.attributes()['id']) {
					this.application.id = it.attributes()['id'].toLong()	
				}
				it.each {			
					this.application.setFromXML(it)
				}
			} else if (it.text().isDouble()) {
				this."$it.name" = Double.parseDouble(it.text())
			} else if(it.name == "dateCreated" || it.name == "lastUpdated") {
			} else if (it.name == "approved") {
				this.approved = Boolean.parseBoolean(it.text())
			} else { 
				this."$it.name" = it.text()
			}
		}		
	}
	
	
}